import Vue from 'vue';
import { Router } from '@/common/utils/index.js';
import { needLoginPages,IMGSOURCE } from '@/common/config.js';
const router = new Router({ needLoginPages });

Vue.mixin({
	data(){
		return {
		}
	},
	computed: {
	    colorTheme() {
	        return this.$store.state.themeColor + '!important';
	    },
	    colorBgTheme() {
	        return this.$store.state.themeBgColor + '!important';
	    },
	    radioColor() {
	        return '#ec5d2a';
	    },
	    i18n() {
	        return this.$t('defVal');
	    },
	    _top(){
	      let h = uni.upx2px(110);
	      let _h = h + this.StatusBar + 'px';
	      console.log(_h)
	      return _h;
	    }
	},
  methods: {
    // 页面跳转
    handleJump(e) {
      let target = e.currentTarget || e.target,
        url = target.dataset.url || 'back',
        type = target.dataset.type;
      if (url == '' || url == '#') return;
      console.log(type)
      switch (type) {
        case 'SWITCH':
          router.switchTab(url);
          break;
        case 'REDIRECT':
          router.redirectTo(url);
          break;
        case 'RELAUNCH':
          router.reLaunch(url);
          break;
        case 'BACK':
          router.navigateBack();
          break;
        default:
          router.navigateTo(url);
          break;
      }
    }
  }
})
